﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DevPhone.Controls;
using Microsoft.Phone.Controls;

namespace DevPhoneToolkitSample.Samples
{
    public partial class TimePickerBoxSample : PhoneApplicationPage
    {
        public TimePickerBoxSample()
        {
            InitializeComponent();
        }

        private void MsgDateWhenClosed(WindowsBoxResultEventArgs e)
        {
            WindowsBoxService.Settings().DefaultValues();
            if (e.ButtonResult == WindowsBoxButtonResult.ButtonOk)
            {
                MessageBox.Show("Selected Time :" + ((DateTimeWrapper)e.ResultValue).DateTime.ToShortTimeString());
            }
        }

        private void ChkIcoClick(object sender, RoutedEventArgs e)
        {
            // ReSharper disable PossibleInvalidOperationException
            Dtpk.ShowIcon = ChkIco.IsChecked.Value;
            // ReSharper restore PossibleInvalidOperationException
        }

        private void ChkIcoExtClick(object sender, RoutedEventArgs e)
        {
            // ReSharper disable PossibleInvalidOperationException
            if ((bool)ChkIcoExt.IsChecked)
            // ReSharper restore PossibleInvalidOperationException
            {
                var externalicon = new BitmapImage(new Uri("/Images/star.png", UriKind.Relative));
                Dtpk.ExternalIcon = externalicon;
            }
            else
            {
                Dtpk.ExternalIcon = null;
            }
        }
    }
}